package com.frogs.ucenter.dao.ibatis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

import com.frogs.framework.base.dao.ibatis.BaseDaoIbatis;
import com.frogs.ucenter.dao.UserBaseInfoDao;
import com.frogs.ucenter.entity.UserBaseInfo;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("userBaseInfoDao")
public class UserBaseInfoDaoImpl extends BaseDaoIbatis<UserBaseInfo> implements UserBaseInfoDao {

	public UserBaseInfoDaoImpl() {
		super();
		setNameSpace("user_base_info");
	}

	@Required
	@Autowired
	public void setSqlMapClientAutowired(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}

	/**
	 * 插入记录后返回实体
	 */
	@Override
	public UserBaseInfo returnBeanAfterInsert(UserBaseInfo userBaseInfo) {
		try {
			return (UserBaseInfo) getSqlMapClientTemplate().insert(getNameSpace() + ".insert", userBaseInfo);
		} catch (Exception e) {
			return null;
		}
	}
}